package ru.xpparty.scanner;

import java.util.concurrent.Executors;

import ru.xpparty.scanner.model.ScanRequest;

/**
 * Entry point to scanner application. Now plays role of dependency injection
 * container :-).
 * 
 * @author xp.party
 * 
 */
public class Main {
	public static void main(String[] args) {
		ArgumentsBuilder builder = new ArgumentBuilderImpl();
		ScanRequest request = builder.build(args);
		Scanner scanner = new Scanner();
		scanner.setSocketScannerFactory(new SocketScannerFactory() {
			@Override
			public SocketScanner create(String host, int port) {
				return new SocketScanner(host, port);
			}
		});
		scanner.setService(Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 3 / 2));
		ScanResult result = scanner.scan(request);
		System.out.println(result.toString());
	}
}
